﻿@model MvcCmsOptIn.Models.OptInModel
@section HtmlHead{
    <link href="@Url.Content("/areas/mvccmsoptin/content/demo_page.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("/areas/mvccmsoptin/content/demo_table.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("/areas/mvccmsoptin/content/demo_table_jui.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("/areas/mvccmsoptin/content/start/jquery-ui-1.8.11.custom.css")" rel="stylesheet" type="text/css" />
    <link href="@Url.Content("/RazorThemes/" + Model._Portal.SkinName + "/css/optin.css")" rel="stylesheet" type="text/css" />
}
<div class="contentpage-outerdiv">
    <div id="container">
        <div class="breadcrumb">
            <span><a href="/optin-manager">Main Menu</a></span><span>» </span><span>News Letters</span>
        </div>
        <table width="600" cellspacing="0" cellpadding="5" border="0" class="frame">
            <tbody>
                <tr>
                    <td class="toolbar" colspan="2">
                        [ <a href="/optin-manager/editnewsletter">Add</a> ]
                    </td>
                </tr>
            </tbody>
        </table>
        <div class="MvcCmsDataGrid">
            <table cellpadding="0" cellspacing="0" border="0" class="display" id="newsLetters">
                <tbody>
                </tbody>
            </table>
        </div>
    </div>
</div>
<select class="optinSearchListParams" id="SearchColumns">
    <option value="All">All</option>
    <option value="Name">Name</option>
</select>
@section ScriptContent{
    <script src="@Url.Content("/areas/mvccmsoptin/scripts/jquery.dataTables.min.js")" type="text/javascript"></script>
    <script src="@Url.Content("/areas/mvccmsoptin/scripts/dataTableExt.oApi.fnSetFilteringPressEnter.js")" type="text/javascript"></script>
    <script id="InitGrid" type="text/javascript" charset="utf-8">
        $(document).ready(function () {
            $('#newsLetters').dataTable({
                bProcessing: true,
                bServerSide: true,
                iDisplayLength: 10,
                bLengthChange: true,
                aaSorting: [[2, 'desc'], [0, 'asc']],
                aLengthMenu: [10, 20, 40],
                aoColumns: [
                { sName: "Name", sTitle: "Name", sWidth: "45%" },
                { sName: "Recipients", sTitle: "Recipients" },
                { sName: "Status", sTitle: "Status" },
                { sName: "ReleaseDate", sTitle: "Release Date" },
                { sName: "Send", sTitle: "Send", bSearchable: false, bSortable: false, sClass: "edit-column" },
                { sName: "Edit", sTitle: "Edit", bSearchable: false, bSortable: false, sClass: "edit-column" },
                { sName: "Delete", sTitle: "Delete", bSearchable: false, bSortable: false, sClass: "edit-column" }
            ],
                bJQueryUI: true,
                sPaginationType: "full_numbers",
                sAjaxSource: "/optinajax/listnewsletters",
                fnInitComplete: function () {
                    var searchFilter = $("#SearchColumns");
                    $("#newsLetters_filter").append(searchFilter);
                },
                fnServerData: function (sSource, aoData, fnCallback) {
                    aoData.push({ name: "sSingleSearchField", value: $("#SearchColumns").val() });
                    $.ajax({
                        "dataType": 'json',
                        "type": "POST",
                        "url": sSource,
                        "data": aoData,
                        "success": fnCallback
                    })
                }
            }).fnSetFilteringPressEnter();
        });
</script>
    <script id="DeleteNewsLetter" type="text/javascript">
        function DeleteNewsLetter(newsLetterId) {
            if (!confirm("Are you sure you want to delete newsletter " + newsLetterId + "?")) {
                return false;
            }
            window.location.href = "/optin-manager/deletenewsletter/" + newsLetterId;
        }
    </script>

}
@section SideBar{
}
